home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F37391B5-821F-11D2-81A0-B4C03AE11570}#2.0#0"; "ONTOPOCX.OCX"
- Begin VB.Form frmOnTop
- Caption = "ForeGround Window Sample"
- ClientHeight = 1830
- ClientLeft = 165
- ClientTop = 735
- ClientWidth = 3780
- LinkTopic = "Form1"
- ScaleHeight = 1830
- ScaleWidth = 3780
- StartUpPosition = 3 'Windows Default
- Begin OnTop.OnTopOCX OnTopOCX1
- Left = 150
- Top = 1200
- _ExtentX = 582
- _ExtentY = 582
- End
- Begin VB.CommandButton cmdQuit
- Caption = "Quit"
- Height = 465
- Left = 900
- TabIndex = 1
- Top = 1200
- Width = 1965
- End
- Begin VB.CheckBox chkTopMost
- Caption = "Keep window on top"
- Height = 465
- Left = 900
- TabIndex = 0
- Top = 300
- Width = 1965
- End
- Begin VB.Menu mnuOptions
- Caption = "Options"
- Begin VB.Menu mnuTopMost
- Caption = "Keep Window on top"
- End
- End
- Attribute VB_Name = "frmOnTop"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' -------------------------------------------------------------
- ' Copyright
- 1998 CMeProducts
- ' This example of the OnTopOCX shows how simple it is to
- ' put any window in the foreground, forcing it to stay on
- ' top of any window.
- ' The syntax for use is:
- ' OnTopOCX1.ForeGround(form-name)=True (or False)
- ' 'form-name' is the name of the form you wish to
- ' set to the foreground.
- ' -------------------------------------------------------------
- Option Explicit
- Private Sub chkTopMost_Click()
- 'Set window to foreground depending on user choice
- If chkTopMost.Value = 1 Then
- OnTopOCX1.ForeGround(Me) = True 'Set topmost
- mnuTopMost.Checked = True 'Put check mark on option menu
- Else
- OnTopOCX1.ForeGround(Me) = False 'Set normal
- mnuTopMost.Checked = False 'Remove check mark from menu
- End If
- End Sub
- Private Sub cmdQuit_Click()
- ' Close program
- Unload Me
- End Sub
- Private Sub Form_Load()
- ' Set Form to startup centre screen
- Me.Left = (Screen.Width - Me.Width) / 2
- Me.Top = (Screen.Height - Me.Height) / 2
- End Sub
- Private Sub mnuTopMost_Click()
- 'Place or remove check mark from menu
- mnuTopMost.Checked = Not mnuTopMost.Checked
- If mnuTopMost.Checked = True Then
- OnTopOCX1.ForeGround(Me) = True 'Set topmost
- chkTopMost.Value = 1 'Put check mark in check box
- Else
- OnTopOCX1.ForeGround(Me) = False 'Set normal
- chkTopMost.Value = 0 'Remove check mark from check box
- End If
- End Sub
-